#ifndef GAME_H
#define GAME_H

#include <QObject>
#include <QVector>

#include <physics/pworld.h>
#include <game/player.h>

class KeyManager;

class Game : public QObject
{
    Q_OBJECT
public:
    explicit Game(KeyManager *manager, QObject *parent = 0);

    virtual void timerEvent(QTimerEvent *);

    virtual void pause();
    virtual void play();
    void refresh();

    PWorld *getWorld() const;
    QVector<Player *> getPlayers() const;
    QString getState() const;

    void serialize(QDomDocument *doc, QDomElement *e) const;

    void deserializeMe(QDomNode e);

    void deserializeCommand(QDomNode e);

    //void serializeCommand();

signals:
    void updated();

public slots:

protected:
    PWorld *myWorld;
    QVector<Player *> myPlayers;
private:
    int myTimer;
    QString myState;
    QString myStartState;
    KeyManager *myKeyManager;

    //void (*myFunc)();
};

#endif // GAME_H
